<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%-- <%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListPage.jsp" %> --%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
</head>
<style>
    select {
        width: 234px;
        height: 31px
    }

    .gn_name {
        padding-top: 5px
    }

    .div_zilei {
        width: 100%;
        height: 30px
    }

    .tr {
        height: 40px;
        background: #57a0ff;
        font-weight:700;
    }

    .tr td {
        font-size: 14px;
        color: #ffffff
    }

    .tr_td {
        height: 40px;
    }

    .tr_td td {
        border-bottom: 1px solid #ededed;
        text-align: center;
    }

    tr td:nth-child(1) {
        font-size: 14px;
        color: #cccccc
    }

    .date {
        border: 0;
        background: #ffffff;
        text-align: center;
    }
     .fseq{border: none;
    	  width: 20px;
    	  color: #cccccc; 
   	}

    .tr_td td:nth-child(1) {
        border-left: 1px solid #cccccc;
    }

    .tr_td td:nth-child(3) {
        border-right: 1px solid #cccccc;
    }

    .addTable.deleteTable:HOVER {
        cursor: pointer;
    }

    type[type='checkbox'] {
        width: 15px
    }
    	.modal-data1 {
			  visibility: hidden; 
			  z-index: 1001;
			  width: 1000px;
			  min-height: 500px;
			  margin: 100px auto;
			  background-color: #FFFFFF;
			 /* border: 1px solid #C80B14;*/
			 -moz-box-shadow:0 10px 20px #8AC1E2 inset,0 -10px 0 #57a0ff inset;
        	 -webkit-box-shadow:0 10px 20px #8AC1E2 inset,0 -10px 0 #57a0ff inset;
      /*         box-shadow:0 0 10px #cccccc; 
			  box-shadow: #cccccc; */
			  box-shadow: 0 10px 20px #57a1ff inset,0 -10px 0 #57a0ff inset;
			  padding: 5px;
			  text-align: center;
			  position: fixed;
			  left: 22%;
		}
		
		.modal-data1 td{padding-left: 15px;padding-right: 15px}
		.modal-data1 tr:FIRST-CHILD td{padding: 0px 10px;}
		.modal-data1 tr{padding-top: 30px}
		.modal-data1 form table {
			margin: 0px
		}
    .div_input_hang {
        width: 100%;
        height: 40px;
    }
    .input_hang {
        float: left;
        width: 500px;
        height: 40px;
    }
</style>
<body style="background: #f5f5f5">
<div class="main">
    <div id="modal-overlay">

    </div>
    
    	<div class="modal-data1" >
				<div style="height: 60px">
				 <ul>
				  	<li  style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
				  		<span>名称：</span>
				  		<span>
				  		 	<input class="name1" type="text" >
				  		</span>
				  		<span>
				  			<button class="findBtn1">
				  				查询
				  			</button>
				  		</span>
				  	</li>
				 </ul>
				</div>
				<div style="width:1000px; height:350px; overflow:scroll;">
			      <form action="">
			        <table class="head1"  style="width: auto;white-space:nowrap;border-spacing:0px">
			        <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
			        <td style="width: 20px"></td> 
			        <td>
			        	编码
			        </td>
			        <td>
			        	名称
			        </td>
			        <td>
			        	准考证明编号
			        </td>
			        <td>
			        	身份证号码
			        </td>			       
			        <td>
			        	手机
			        </td>
			        <td>
			        	申领类型
			        </td>
			        <td>
			        	入学日期
			        </td>
			        <td>
			        	性别
			        </td>
			        <td>
			        	欠费
			        </td>
			        <td>
			        	业务日期
			        </td>
			        <td>
			        	单据状态
			        </td>			       
			        <td>
			        	车型
			        </td>			       			       
			        </tr>			        
			        </table>
			      </form>
                    <button class="subtn1"
                            style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;left: 280px">
			      	确定
			      </button>
                    <button class="btn"
                            style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;right: 280px">
			      	关闭
			      </button>
			     </div>			    
			</div>
    
    <div class="weizhi">
        考试管理>>科目一考试结果登记>>新增
    </div>
    <div class="div_body" style="box-shadow: 0 0 5px #cccccc;height:900px">

        <div class="div_form">
            <form action="<%=path%>/DrivingSys/addSubjectOneResult" method="post" class="form" onsubmit="return subForm()">
                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">驾校&nbsp;:&nbsp;</span>
                        <input type="text" name="name" value="${department.fnameL2}" readonly="readonly" style="color: gray;"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">单据编号&nbsp;:&nbsp;</span>
                        <input type="text" name="fnumber" value="${fnumber}" style="color: gray;" readonly="readonly"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">考试日期&nbsp;:&nbsp;</span>
                        <input type="text" class="ksrq" name="fbizdate" id="ywrq" value="${time}"
                               onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})" onchange="changeFbizdate($(this))"/>
                        <img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"
                             src="<%=path%>/image/date.jpg" align="absmiddle" style="padding-left: 15px">
                    </div>
                </div>
                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">参考信息&nbsp;:&nbsp;</span>
                        <input name="fdescription"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">单据状态&nbsp;:&nbsp;</span>
                        <select name="cfbillstate" >
                            <option style="color: gray;" value="3">新增</option>
                        </select>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">车型&nbsp;:&nbsp;</span>
                        <select class="cfcartype" name="cfcartype" onchange="changeCartype()">
                        	<option value="A1">A1</option>
                        	<option value="A2">A2</option>
                        	<option value="A3">A3</option>
                        	<option value="B1">B1</option>
                        	<option value="B2">B2</option>
                        	<option value="C1" selected="selected">C1</option>
                        	<option value="C2">C2</option>
                        	<option value="C3">C3</option>
                        	<option value="C4">C4</option>
                        	<option value="D">D</option>
                        	<option value="E">E</option>
                        	<option value="F">F</option>
                        	<option value="M">M</option>
                        	<option value="N">N</option>                       	
                        	<option value="P">P</option>
                        </select>
                        
                    </div>
                </div>             
                <div class="div_zilei">
                    <div style="width: 93%;text-align: right;">
                        <img src="<%=path%>/image/insert2323.jpg" class="addTable">
                        <span style="padding-right: 20px;color: #57a0ff;font-weight:700;font-size: 14px" class="addTable">添加</span>
                        <img src="<%=path%>/image/delete212.png" class="deleteTable">
                        <span class="deleteTable" style="color:#57a0ff;font-weight:700;font-size: 14px" class="deleteTable">删除</span>
                    </div>
                </div>
                <div style="overflow:auto;/* min-height: 200px; */width: 88%; height:350px;margin-left: 90px">
                    <table id="table1" style="min-height:50px;border-spacing:0;width: auto;white-space:nowrap;">
                        <tr  class="tr">
                        	<td><%--<input type="checkbox" style="width: 15px;" name="check" class="check1">--%></td>
                            <td align="center">序号</td>
                            <td style="width: 90px;" align="center">准考证明编号</td>
                            <td style="width: 90px;" align="center">学员编码</td>
                            <td style="width: 90px;" align="center">学员</td>
                            <td style="width: 90px;" align="center">身份证号</td>
                            <td style="width: 90px;" align="center">性别</td>
                            <td style="width: 90px;" align="center">手机</td>
                            <td style="width: 90px;" align="center">电话</td>
                            <td style="width: 90px;" align="center">申请车型</td>
                            <td style="width: 90px;" align="center">班级</td>
                            <td style="width: 90px;" align="center">应收金额</td>
                            <td style="width: 90px;" align="center">已收</td>
                            <td style="width: 90px;" align="center">欠费</td>
                            <td style="width: 90px;" align="center">优惠</td>                   
                            <td style="width: 90px;" align="center">vip</td>
                            <td style="width: 90px;" align="center">本地/异地</td>
                            <td style="width: 90px;" align="center">考试结果</td>
                            <td style="width: 90px;" align="center">备注</td>                       
                        </tr>
                    </table>
                </div>

                
				<div class="div_input_hang">
                    
                </div>
                <div class="div_input_hang">
                    <div class="input_hang">
                        <span class="gn_name">审核人&nbsp;:&nbsp;</span>
                        <input  disabled="disabled" name="checkName"/>
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">创建者&nbsp;:&nbsp;</span>
                        <input  disabled="disabled" name="createName" value="${user.name }"/>
                        
                    </div>
                    <div class="input_hang">
                        <span class="gn_name">创建时间&nbsp;:&nbsp;</span>
                        <input disabled="disabled" name="fcreatetime"  style="color: gray;" readonly="readonly" value=""/>
                    </div>
                </div>

                <div class="div_tj" style="padding-top: 0px;margin-top: 10px;margin-left: 140px;">
                    <div>
                        <input onclick="chcek()" class="input_submit bc" value="" type="submit" style="margin-top: 0px;margin-right: 30px;">
                    </div>
                    <div>
                        <input type="button" class="input_back fh" value="" onclick="back()" style="margin-top: 0px;"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<!-- <script id="table-template1-sub" type="text/x-handlebars-template">    
</script>-->
<script type="text/javascript">
    $(document).ready(function(){
        var type = "${type}";
        if(type == "1"){
           // alert("添加成功!");
            editAlert();
        }
    })
  	//处理删除时候的this缓存
    var _this;
    //删除一行
    $(".deleteTable").click(function () {
    	var k =0;
    	$("input:checkbox[name=checkchilden]:checked").each(function(i){
    		k++;
    	})
    	if(k == 0){
    		alert("请勾选需要删除的行!")
    		return false;
    	}
    	//删除
    	$("input:checkbox[name=checkchilden]:checked").each(function(i){
    		$(this).parent().parent().remove();
    	})
    	//处理序号
		$(".fseq").each(function(i){
			$(this).val(i+1)
		})
		$(".check1").removeAttr('checked')
    })
   
    //增加学员数据
    function addStudentMesg(json){
        var student=json.studentsNameList;
        var students = "";
        var count =0;//计数
        for (var i = 0; i < student.length; i++) {
            //alert("需要添加的学员id" + student[i].fid)
            $(".subfid").each(function (j) {
                //alert("已经有的id：" + $(this).val())
                if ($(this).val() == student[i].fid) {
                    var name = $(this).parent().parent().find("td input[name=stuname]").val();
                    if (count == 0) {
                        students = name;
                    } else {
                        students += "," + name;
                    }
                    count++;
                }
            })
        }
        if(students != ''){
            alert(students+" 已经在列表中,请重新选择学员!")
            return false;
        }
    	var htmlperson = "<tr><td class='td'><input style='width: 15px;' type='checkbox' name='checkchilden'></td>" +
        "<td align='center' width='20px' ><input type='text' class='fseq' name='stufseq'value='' readonly=\"readonly\"></td> " +
        "<td align='center'><input class='jlznamebm' style='width: 90px;' type='text' name='stucfzkzmbh' value='' readonly=\"readonly\"/>" +
        "</td><td align='center'><input style='width: 170px;' type='text' name='stufnumber' value=''  readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stuname' value=''  class='is_click_ne' onclick='clickName($(this))' readonly=\"readonly\"/> <input style='width: 90px;' type='hidden' name='stuid'  class='subfid' value=''/>" +
        "</td><td align='center'><input style='width: 140px;' type='text' name='stucfidcardno' value='' readonly=\"readonly\"/></td> " +
        "<td align='center'><input style='width: 90px;' type='text' name='stucfsex' value='' readonly=\"readonly\"/>" +
        "</td><td align='center'><input style='width: 90px;' type='text' name='stucfsjhm' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stucflxdh' value='' readonly=\"readonly\"/>" +
        "</td><td align='center'><input style='width: 90px;' type='text' name='stucfslzjcxdh' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 150px;' type='text' name='stucfclazzName' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stucfamount' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stucfreceived' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stucfarrearage' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 90px;' type='text' name='stucffavorable' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><input style='width: 45px;' type='checkbox' name='' value='0' onclick='clickvip($(this))' readonly=\"readonly\"/> <input style='width: 90px;' type='hidden' name='stucfvip' value='1'/></td> " +
        "<td align='center'><input style='width: 90px;' type='text' name='stucflocal' value='' readonly=\"readonly\"/></td>" +
        "<td align='center'><select name='stucfexamresult' style='width: 90px;'><option value='1'>合格</option><option value='2'>不合格</option><option value='3'>缺考</option></select></td>" +
        "<td align='center'><input style='width: 140px;' type='text' name='stucfremark' value=''/></td>" +
       " </tr>";          

    	for (var i = 0; i < student.length; i++) {
    		if(_this == null){
    			$("#table1").append(htmlperson)                     	
                $("#table1 tr:last").find("td").eq(2).children("input").val(student[i].cfzkzmbh)
            	$("#table1 tr:last").find("td").eq(3).children("input").val(student[i].fnumber)
            	$("#table1 tr:last").find("td").eq(4).children("input").val(student[i].fnameL2)
            	$("#table1 tr:last").find("td").eq(4).children("input").next().val(student[i].fid)
            	//alert(_this.find("td").eq(3).children("input").next().val())
            	$("#table1 tr:last").find("td").eq(5).children("input").val(student[i].cfidcardno)
            	if(student[i].cfsex == 1){
            		student[i].cfsex='男'
            	}else{
            		student[i].cfsex='女'
            	}
                $("#table1 tr:last").find("td").eq(6).children("input").val(student[i].cfsex)
            	$("#table1 tr:last").find("td").eq(7).children("input").val(student[i].cfsjhm)
            	$("#table1 tr:last").find("td").eq(8).children("input").val(student[i].cflxdh)
            	$("#table1 tr:last").find("td").eq(9).children("input").val(student[i].cfslzjcxdh)
            	$("#table1 tr:last").find("td").eq(10).children("input").val(student[i].cfclazzName)
            	$("#table1 tr:last").find("td").eq(11).children("input").val(student[i].cfamount)
            	$("#table1 tr:last").find("td").eq(12).children("input").val(student[i].cfreceived)
            	$("#table1 tr:last").find("td").eq(13).children("input").val(student[i].cfarrearage)
            	if(student[i].cffavorable == null){
            		student[i].cffavorable = 0;
            	}
            	$("#table1 tr:last").find("td").eq(14).children("input").val(student[i].cffavorable)           	
            	if(student[i].cflocal == 1){
            		student[i].cflocal='本地'
            	}else if(student[i].cflocal ==2){
            		student[i].cflocal='异地'
            	}else{
            		student[i].cflocal='学生'
            	}
                $("#table1 tr:last").find("td").eq(16).children("input").val(student[i].cflocal)
                
    		}else{
    			_this.find("td").eq(2).children("input").val(student[0].cfzkzmbh)
             	_this.find("td").eq(3).children("input").val(student[0].fnumber)
             	_this.find("td").eq(4).children("input").val(student[0].fnameL2)
             	_this.find("td").eq(4).children("input").next().val(student[0].fid)
             	//alert(_this.find("td").eq(3).children("input").next().val())
             	_this.find("td").eq(5).children("input").val(student[0].cfidcardno)
             	if(student[0].cfsex == 1){
             		student[0].cfsex='男'
             	}else{
             		student[0].cfsex='女'
             	}
             	_this.find("td").eq(6).children("input").val(student[0].cfsex)
             	_this.find("td").eq(7).children("input").val(student[0].cfsjhm)
             	_this.find("td").eq(8).children("input").val(student[0].cflxdh)
             	_this.find("td").eq(9).children("input").val(student[0].cfslzjcxdh)
             	_this.find("td").eq(10).children("input").val(student[0].cfclazzName)
             	_this.find("td").eq(11).children("input").val(student[0].cfamount)
             	_this.find("td").eq(12).children("input").val(student[0].cfreceived)
             	_this.find("td").eq(13).children("input").val(student[0].cfarrearage)
             	if(student[i].cffavorable == null){
            		student[i].cffavorable = 0;
            	}
             	_this.find("td").eq(14).children("input").val(student[0].cffavorable)           	
             	if(student[0].cflocal == 1){
             		student[0].cflocal='本地'
             	}else if(student[0].cflocal ==2){
             		student[0].cflocal='异地'
             	}else{
             		student[0].cflocal='学生'
             	}
             	_this.find("td").eq(16).children("input").val(student[0].cflocal)
             	//清除_this
             	_this=null;
    		}
    		//处理序号
    		$(".fseq").each(function(i){
    			$(this).val(i+1)
    		})             
		}
        return true;
        
    }
    $('.addTable').click(function () {
    	var fbizdate=$("#ywrq").val();
    	if(fbizdate == null || fbizdate == ''){
    		alert("请选择业务日期！")
    		$("#ywrq").focus()
    	}else{
    		 clickName(null)  		 
        	 $('#modal-overlay').css('visibility', 'visible')
             $('.modal-data1').css('visibility', 'visible')
             $('input:checkbox[name=student]').removeAttr('checked');
             $('.page').show();
    	}
        
    }) 


    /* 关闭弹出框    */
    $('.btn').click(function () {
    	_this=null;
        $('#modal-overlay').css('visibility', 'hidden')
        $('.modal-data1').css('visibility', 'hidden')
        $('.modal-data').css('visibility', 'hidden')
        $('.head1 input:checkbox[name=student]').removeAttr('checked');
        $('.page').hide();
    })



    //弹出模式框
    function clickName(e) {
    	$(".head1 tr:not(':first')").remove()
    	//获取考试日期
    	var fbizdate=$(".ksrq").val()
    	//alert(fbizdate)
    	//获取车型
    	var cfcartype=$(".cfcartype").val()
    	//alert(cfcartype)
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data1').css('visibility', 'visible')
        $('.head1 input:checkbox[name=student]').removeAttr('checked');
    	if(e != null){
    		_this = e.parent().parent();
    	}        
        //根据考试日期和车型去后台取数据      
        $.ajax({
            url: '<%=path%>/DrivingSys/selStudentsBySubscribedOne',
            type: "post",
            data: {'fbizdate': fbizdate,'cfcartype':cfcartype},
            dataType: "json",
            success: function (json) {  
            	//alert(json.length)
            	if(json.length == 0){
            		/*alert("目前还没有相关数据,请重新选择考试日期和车型！")*/
            		var nostr='<tr><td style="width: 30px;"></td><td colspan="5">目前还没有相关数据,请重新选择考试日期和车型！</td></tr>'
            			$(".head1").append(nostr)
            	}else{
                    var str ='';
            		for (var i = 0; i < json.length; i++) {
            			if(json[i].cfsex == 1){
            				json[i].cfsex='男';
            			}else{
            				json[i].cfsex='女';
            			}
            			if(json[i].cfzkzmbh == null){
                            json[i].cfzkzmbh = "";
                        }
                        str+='<tr class="xysj"><td class="td" style="width: 20px;"><input style="width: 20px;" type="checkbox" name="student" value="'+json[i].cfstudentid+'" ></td>';
            			str+='<td>'+json[i].cfstudentname+'</td><td>'+json[i].studentName+'</td><td>'+json[i].cfzkzmbh+'</td><td>'+json[i].cfidcardno+'</td>'
            			str+='<td>'+json[i].cfmobile+'</td><td>初次申领</td><td>'+json[i].cfrxsj+'</td>'
            			str+='<td>'+json[i].cfsex+'</td><td>'+json[i].cfqfje+'</td><td>'+fbizdate+'</td>'
            			str+='<td>审核</td><td>'+cfcartype+'</td></tr>';
					}
                    $(".head1").append(str)
            	}
            	
            },
            error: function () {
                alert('Error');
            }
        });
    }
    //查找学员信息
    $(".findBtn1").click(function(){
    	$(".head1 tr:not(':first')").remove()
    	//获取考试日期
    	var fbizdate=$(".ksrq").val()
    	//alert(fbizdate)
    	//获取车型
    	var cfcartype=$(".cfcartype").val()
    	//获取名称
    	var name = $(".name1").val();
    	//alert(name)
    	 //根据考试日期和车型去后台取数据      
        $.ajax({
            url: '<%=path%>/DrivingSys/selStudentsBySubscribedOne',
            type: "post",
            data: {'fbizdate': fbizdate,'cfcartype':cfcartype,'name':name},
            dataType: "json",
            success: function (json) {  
            	//alert(json.length)
            	if(json.length == 0){
            		//alert("目前还没有相关数据,请重新选择考试日期和车型！")           		
            		var nostr='<tr><td style="width: 30px;"></td><td colspan="5">目前还没有相关数据,请重新选择考试日期和车型！</td></tr>'

                    $(".head1").append(nostr)
            	}else{
            	    var str ='';
            		for (var i = 0; i < json.length; i++) {
            			if(json[i].cfsex == 1){
            				json[i].cfsex='男';
            			}else{
            				json[i].cfsex='女';
            			}
            			if(json[i].cfzkzmbh == null){
                            json[i].cfzkzmbh = '';
                        }
                        str +='<tr class="xysj"><td class="td" style="width: 20px;"><input  style="width: 20px;" type="checkbox" name="student" value="'+json[i].cfstudentid+'"></td>';
            			str+='<td>'+json[i].cfstudentname+'</td><td>'+json[i].studentName+'</td><td>'+json[i].cfzkzmbh+'</td><td>'+json[i].cfidcardno+'</td>'
            			str+='<td>'+json[i].cfmobile+'</td><td>初次申领</td><td>'+json[i].cfrxsj+'</td>'
            			str+='<td>'+json[i].cfsex+'</td><td>'+json[i].cfqfje+'</td><td>'+fbizdate+'</td>'
            			str+='<td>审核</td><td>'+cfcartype+'</td></tr>';
					}
                    $(".head1").append(str)
            		
            	}
            	
            },
            error: function () {
                alert('Error');
            }
        });
    })
    //摸态框设置单击选中
    $(document).on('click','.xysj td:not(.td)',function(){
    	if($(this).parent().find("input:checkbox[name=student]").is(':checked')){
    		$(this).parent().find("input:checkbox[name=student]").removeAttr("checked");
    	}else{
    		$(this).parent().find("input:checkbox[name=student]").attr("checked",":checked")
    	}
    }) 
    //摸态框设置双击确定
 $(document).on('dblclick','.xysj td',function(){
	var id=$(this).parent().find("input:checkbox[name=student]").val(); 
   	if(id == null  ){
	   return false;
  	}
 	   $.ajax({
           url: '<%=path%>/DrivingSys/selStudentsByFid',
           type: "post",
           async: true,
           data: {'id': id},
           dataType: "json",
           success: function (json) {
        	   var flag=addStudentMesg(json)
               if(flag){
                   $('#modal-overlay').css('visibility', 'hidden')
                   $('.modal-data1').css('visibility', 'hidden')
                   $('.head1 input:checkbox[name=student]').removeAttr('checked');
               }
           },
           error: function () {
               alert('Error');
           }
 	}) 
 })
 	
     function clickvip(obj){
    	 if(obj.prop("checked")){
    		 obj.next().val(0)
    	 }else{
    		 obj.next().val(1)
    	 }
     }
    //把选中的信息名称填充到输入框中
    $('.subtn1').click(function () {
        var spCodesTemp = "";      
        $('input:checkbox[name=student]:checked').each(function (i) {
            if (0 == i) {
                //把学生id增加到字表中
                spCodesTemp = $(this).val();  
            } else {
                spCodesTemp += ("," + $(this).val());
            }
        });
        if(spCodesTemp == '' || spCodesTemp == null){
        	alert("至少勾选一项!")
        	return false;
        }
        $.ajax({
            url: '<%=path%>/DrivingSys/selStudentsByFid',
            type: "post",
            data: {'id': spCodesTemp},
            dataType: "json",
            success: function (json) {           	
            	var flag=addStudentMesg(json)
                if(flag){
                    $('#modal-overlay').css('visibility', 'hidden')
                    $('.modal-data1').css('visibility', 'hidden')
                    $('.head1 input:checkbox[name=student]').removeAttr('checked');
                }

            },
            error: function () {
                alert('Error');
            }
        });

    });
    //设置全选功选 
	$('.check1').live('click',function(){
		if($(this).attr("checked")){
			 $("input:checkbox[name=checkchilden]").prop("checked",true) 
		}else{
			$('input:checkbox[name=checkchilden]').removeAttr('checked')
		}
	})
  //单击选中
  $("#table1 tr td:not(.td)").live('click',function(){
    if($(this).parent().find("input:checkbox").is(':checked')){
    	$(this).parent().find("input:checkbox[name=checkchilden]").removeAttr("checked");
    }else{
    	$(this).parent().find("input:checkbox[name=checkchilden]").attr("checked",":checked")
    }
 	}) 
   
  //返回
	function back(){
        parent.closeSelectCard()

        //location = '<%=path%>/DrivingSys/querySubjectOneResult/look.action';
	}
    function subForm(){
        var count =0;
        $("input:checkbox[name=checkchilden]").each(function(i){
            count ++;
        })
        if(count == 0){
            alert("请先添加学员!")
            return false;
        }
        $("input[type='submit']").attr("disabled", "disabled");
    }
    //改变业务日期或者车型清空已经增加的学员
    var oldTime ="";//记录改变之前的时间
    function changeFbizdate(obj) {
        if(oldTime  == '' ){
            oldTime = $("#ywrq").val()
        }
        var k = 0;
        $("input:checkbox[name=checkchilden]").each(function(i){
            k++;
        })
        if(k != 0){
            $.messager.confirm('提示', '考试时间或者车型改变，将清空之前录入的学员数据!', function (r) {
                if (r) {
                    //接业务代码
                    $("input:checkbox[name=checkchilden]").each(function(i){
                        $(this).parent().parent().remove()
                    })
                    oldTime = $("#ywrq").val()
                }else{
                    $("#ywrq").val(oldTime)
                }
             });
        }else{//把oldTime赋值
            oldTime = $("#ywrq").val()
        }
    }
    var oldCartype = $(".cfcartype").val();//记录之前的车型
    function changeCartype() {
        var k = 0;
        $("input:checkbox[name=checkchilden]").each(function(i){
            k++;
        })
        if(k != 0){
            $.messager.confirm('提示', '考试时间或者车型改变，将清空之前录入的学员数据!', function (r) {
                if (r) {
                    $("input:checkbox[name=checkchilden]").each(function (i) {
                        $(this).parent().parent().remove()
                    })
                    oldCartype = $(".cfcartype").val()
                } else {
                    $(".cfcartype").val(oldCartype)
                }
            })
        }else{//把oldTime赋值
            oldCartype = $(".cfcartype").val()
        }
    }
</script>
</html>